﻿
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Extensions;
using Digitalmes.Model.AndonManagement;
using Digitalmes.Model;

namespace Digitalmes.ViewModel.AndonManagement.IssueRecordVMs
{
    public partial class IssueRecordTemplateVM : BaseTemplateVM
    {
        
        [Display(Name = "_Model._IssueRecord._OpId")]
        public ExcelPropety OpId_Excel = ExcelPropety.CreateProperty<IssueRecord>(x => x.OpId);
        [Display(Name = "_Model._IssueRecord._OpName")]
        public ExcelPropety OpName_Excel = ExcelPropety.CreateProperty<IssueRecord>(x => x.OpName);
        [Display(Name = "_Model._IssueRecord._IssueType")]
        public ExcelPropety IssueType_Excel = ExcelPropety.CreateProperty<IssueRecord>(x => x.IssueTypeId);
        [Display(Name = "_Model._IssueRecord._IssueTypeName")]
        public ExcelPropety IssueTypeName_Excel = ExcelPropety.CreateProperty<IssueRecord>(x => x.IssueTypeName);
        [Display(Name = "_Model._IssueRecord._ReportTime")]
        public ExcelPropety ReportTime_Excel = ExcelPropety.CreateProperty<IssueRecord>(x => x.ReportTime, true);
        [Display(Name = "_Model._IssueRecord._Reporter")]
        public ExcelPropety Reporter_Excel = ExcelPropety.CreateProperty<IssueRecord>(x => x.Reporter);
        [Display(Name = "_Model._IssueRecord._Description")]
        public ExcelPropety Description_Excel = ExcelPropety.CreateProperty<IssueRecord>(x => x.Description);
        [Display(Name = "_Model._IssueRecord._Handler")]
        public ExcelPropety Handler_Excel = ExcelPropety.CreateProperty<IssueRecord>(x => x.Handler);
        [Display(Name = "_Model._IssueRecord._HandleTime")]
        public ExcelPropety HandleTime_Excel = ExcelPropety.CreateProperty<IssueRecord>(x => x.HandleTime, true);
        [Display(Name = "_Model._IssueRecord._HandleResult")]
        public ExcelPropety HandleResult_Excel = ExcelPropety.CreateProperty<IssueRecord>(x => x.HandleResult);
        [Display(Name = "_Model._IssueRecord._Status")]
        public ExcelPropety Status_Excel = ExcelPropety.CreateProperty<IssueRecord>(x => x.Status);
        [Display(Name = "_Model._IssueRecord._Remark")]
        public ExcelPropety Remark_Excel = ExcelPropety.CreateProperty<IssueRecord>(x => x.Remark);
        [Display(Name = "_Model._IssueRecord._Station")]
        public ExcelPropety Station_Excel = ExcelPropety.CreateProperty<IssueRecord>(x => x.StationId);
        [Display(Name = "_Model._IssueRecord._CreateTime")]
        public ExcelPropety CreateTime_Excel = ExcelPropety.CreateProperty<IssueRecord>(x => x.CreateTime, true);
        [Display(Name = "_Model._IssueRecord._UpdateTime")]
        public ExcelPropety UpdateTime_Excel = ExcelPropety.CreateProperty<IssueRecord>(x => x.UpdateTime, true);
        [Display(Name = "_Model._IssueRecord._CreateBy")]
        public ExcelPropety CreateBy_Excel = ExcelPropety.CreateProperty<IssueRecord>(x => x.CreateBy);
        [Display(Name = "_Model._IssueRecord._UpdateBy")]
        public ExcelPropety UpdateBy_Excel = ExcelPropety.CreateProperty<IssueRecord>(x => x.UpdateBy);
        [Display(Name = "_Model._IssueRecord._IsValid")]
        public ExcelPropety IsValid_Excel = ExcelPropety.CreateProperty<IssueRecord>(x => x.IsValid);
        [Display(Name = "_Model._IssueRecord._TenantCode")]
        public ExcelPropety TenantCode_Excel = ExcelPropety.CreateProperty<IssueRecord>(x => x.TenantCode);

	    protected override void InitVM()
        {
            
            IssueType_Excel.DataType = ColumnDataType.ComboBox;
            IssueType_Excel.ListItems = DC.Set<IssueType>().GetSelectListItems(Wtm, y => y.TenantCode.ToString());
            Station_Excel.DataType = ColumnDataType.ComboBox;
            Station_Excel.ListItems = DC.Set<AndonStation>().GetSelectListItems(Wtm, y => y.TenantCode.ToString());

        }

    }

    public class IssueRecordImportVM : BaseImportVM<IssueRecordTemplateVM, IssueRecord>
    {
            //import

    }

}